package com.woniuxy.project.campus.account.mapper;

import com.woniuxy.project.campus.account.dto.GetAllAuthorityName;
import com.woniuxy.project.campus.account.model.RoleAccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 吴彦祖
 * @since 2025年02月17日
 */
@Mapper
public interface RoleAccountMapper extends BaseMapper<RoleAccount> {

    @Select("SELECT \n" +
            "    r.name as roleName,\n" +
            "    r.id as RoleId,\n" +
            "    a.name as accountName,\n" +
            "    a.id as accountId\n" +
            "FROM \n" +
            "    role_account ra\n" +
            "JOIN \n" +
            "    account a ON ra.account_id = a.id\n" +
            "JOIN \n" +
            "    role r ON ra.role_id = r.id;")
    List<GetAllAuthorityName> selectAllAuthorityName();
}
